﻿<UserControl x:Class="Test.Silverlight.DataGrid.Grouping"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:grid="clr-namespace:DevExpress.AgDataGrid;assembly=DevExpress.AgDataGrid.v8.2">
    
    <UserControl.Resources>
        <DataTemplate x:Name="OptionsPanelTemplate">
            <StackPanel Orientation="Horizontal">
                <Button Content="Expand All" Margin="0,0,10,0" Width="115" Click="expand_Click"/>
                <Button Content="Collapse All" Width="115" Click="collapse_Click"/>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">
        <grid:AgDataGrid x:Name="grid" DelayScrolling="True" ColumnsAutoWidth="True" ChangeOddRowsAppearance="True" ShowTotals="Visible" ShowGroupPanel="Visible" AutoGenerateColumns="True" >
            <grid:AgDataGrid.Columns>
                <grid:AgDataGridTextColumn FieldName="country" HeaderContent="Country" GroupIndex="0"/>
                <grid:AgDataGridTextColumn FieldName="city" HeaderContent="City" GroupIndex="1"/>
                <grid:AgDataGridDateColumn FieldName="orderdate" HeaderContent="Order Date"/>
                <grid:AgDataGridTextColumn FieldName="unitprice" HeaderContent="Unit Price" HorizontalContentAlignment="Right"/>
                <grid:AgDataGridTextColumn FieldName="quantity" HeaderContent="Quantity" HorizontalContentAlignment="Right"/>
            </grid:AgDataGrid.Columns>
            <grid:AgDataGrid.Totals>
                <grid:AgDataGridSummaryItem FieldName="country" SummaryType="Count" />
                <grid:AgDataGridSummaryItem FieldName="quantity" SummaryType="Sum" />
            </grid:AgDataGrid.Totals>
        </grid:AgDataGrid>
    </Grid>
    
</UserControl>
